package gui;

import javax.microedition.lcdui.game.Sprite;

import logic.FilesManager;
import logic.LogicHelper;
import logic.MainMidlet;

/**
 * class representing main menu screen
 * @author Rekin
 *
 */
public class MainMenuCanvas extends MenuCanvas{

	private static String[] menuItemsNames = {
    		"Start Game",
    		"Options",
    		"Load Game",
    		"Statistics",
    		"About",
    		"Exit"
    };

	/**
	 * default constructor
	 */
	public MainMenuCanvas() {
		super(menuItemsNames);
	}
	
	/**
	 * pressing items handling
	 */
	protected void menuItemPressed(int buttonIndex)
	{
		super.menuItemPressed(buttonIndex);
		
		if( buttonIndex == 0){
        	MainMidlet.getMidletInstance().startGame();
        }
        else if(buttonIndex == 1){
        	MainMidlet.getMidletInstance().showOptions();
        }
        else if(buttonIndex == 2){
        	MainMidlet.getMidletInstance().loadGame();
        }
        else if(buttonIndex == 3){
        	MainMidlet.getMidletInstance().highscores();
        }
        else if(buttonIndex == 4){
        	MainMidlet.getMidletInstance().about();
        }
        else if(buttonIndex == 5){
        	MainMidlet.getMidletInstance().shutDownApp();
        }
	}

	/**
	 * @Override
	 * handles creating selection sprites
	 */
	protected void initSprites() {
		selectionElement1 = new Sprite(LogicHelper.createImageFromResources("/rotatingCards/leftSelectSequence.png", this), 30, 30);
    	selectionElement2 = new Sprite(LogicHelper.createImageFromResources("/rotatingCards/rightSelectSequence.png", this), 30, 30);
	}
}
